package com.fw.ui.core.authentication;

import java.util.ArrayList;
import java.util.List;

import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

import com.fw.ui.bean.AuthenticationBean;

public class AuthenticationUserToken extends UsernamePasswordAuthenticationToken {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    private AuthenticationBean authenticationBean;
    private boolean authenticated = false;
    private List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
    private String messageCode;

    public AuthenticationUserToken(Object principal, Object credentials) {
	super(principal, credentials);
    }

    public AuthenticationUserToken(Object principal, Object credentials, List<GrantedAuthority> authorities) {
	super(principal, credentials, authorities);
	this.authorities = authorities;
    }

    public boolean isAuthenticated() {
	return authenticated;
    }

    public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException {
	authenticated = isAuthenticated;
    }

    public List<GrantedAuthority> getAuthorities() {
	return authorities;
    }

    public void setAuthorities(List<GrantedAuthority> authorities) {
	this.authorities = authorities;
    }

    public AuthenticationBean getAuthenticationBean() {
	return authenticationBean;
    }

    public void setAuthenticationBean(AuthenticationBean authenticationBean) {
	this.authenticationBean = authenticationBean;
    }

    public String getMessageCode() {
	return messageCode;
    }

    public void setMessageCode(String messageCode) {
	this.messageCode = messageCode;
    }

}
